function IslandCommodityObject(theGame,theCommodity){
	var game = theGame;
	var commodity = theCommodity;
	this.supply = game.getCommodities().getCommodity(commodity).rollSupply();
	this.demand = game.getCommodities().getCommodity(commodity).rollDemand();
	
	this.getCommodity = function(){
		return commodity;
	}
	this.getSupply = function(){
		return this.supply;
	};
	this.getDemand = function(){
		return this.demand;
	};
	this.getPricePerUnit = function(){
		return game.getCommodities().getCommodity(this.getCommodity()).getBasePrice()*this.getDemand()/this.getSupply();
	};
	this.buyUnits = function(unitCount){
		this.demand += game.getCommodities().getCommodity(this.getCommodity()).getDemandFactor(unitCount);
		alert(this.demand);
	};
	this.sellUnits = function(unitCount){
		this.supply += Game.getCommodities().getCommodity(this.getCommodity()).getSupplyFactor(unitCount);
		alert(this.supply);
	};
}
function IslandCommoditiesObject(theGame){
	var game = theGame;
	var commoditiesList = game.getCommodities().getCommodityList();
	for(var index=0;index<commoditiesList.length;++index){
		this[commoditiesList[index]] = new IslandCommodityObject(game,commoditiesList[index]);
	}
	this.getCommodity = function(commodity){
		return this[commodity];
	};
}
